package dongze.com.ckdj.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import dongze.com.ckdj.fragment.BaseFragment;

/**
 * Created by fanqwz on 2017/8/24.
 */

public class CheckInPagerAdapter extends FragmentPagerAdapter {
    private BaseFragment info;
    private BaseFragment opt;

    public CheckInPagerAdapter(FragmentManager fm, BaseFragment info, BaseFragment opt) {
        super(fm);
        this.info = info;
        this.opt = opt;
    }

    @Override
    public Fragment getItem(int position) {
        return position == 0 ? info : opt;
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return position == 0 ? "车辆信息" : "信息录入";
    }

    @Override
    public float getPageWidth(int position) {
        if (1 == position) {
            return 0.8f;
        } else {
            return 0.6f;
        }
    }
}
